package com.tql.mall.merchant.service.imp;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tql.mall.merchant.mapper.ReturnInfoMapper;
import com.tql.mall.merchant.service.ReturnInfoService;
import com.tql.mall.model.order.ReturnInfo;
import com.tql.mall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ReturnInfoServiceImpl extends ServiceImpl<ReturnInfoMapper, ReturnInfo> implements ReturnInfoService {

    @Autowired
    private OrderFeignClient orderFeignClient;

    @Override
    public void returnGood(ReturnInfo returnInfo) {
        // 更新订单状态
        orderFeignClient.updateOrderStatus(returnInfo.getOrderId(), 3);
        // 添加退货记录
        baseMapper.insert(returnInfo);
    }
}
